Learn R Programming

Directional (version 2.2)

Unit vector(s) with a given angle: Unit vector(s) with a given angle

Description

Unit vector with a given angle from a given unit vector.

Usage

vec(x, n = 1, deg = 90)

Arguments

x
A unit vector. If it is not a unit vector it becomes a unit vector.
n
The number of unit vectors to return.
deg
The angle between the given vector and the n vectors to be returned. This must be in degrees and it has to be between 0 and 180 degrees. If the angle is 0, the same unit vector will be returned. If the angle is 180, the same unit vector with the signs changed will be returned.

Value

A list including: A list including:

Details

The user provides a unit vector and the degrees. The function will return n unit vectors whose angle with the given unit vector equals the degrees given. For example, if you want 10 unit vectors purpendicualr to the x put vec(x, 10, 90).

See Also

rvmf, rbingham, rfb

Examples

Run this code
x <- rnorm(10)
a <- vec(x, 20, 90)

Run the code above in your browser using DataLab